package pricecomparison.websitereader;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

/**
 *
 * @author Jim Simon
 */
public class WebsiteReader {
    BufferedReader reader;
    public final boolean DEBUG = false;
    
    public WebsiteReader(String url) throws java.net.MalformedURLException, java.io.IOException {
        try {
            reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
        } catch (java.net.MalformedURLException e) {
            throw e;
        } catch (java.io.IOException e) {
            throw e;
        }
    }
    
    public String readLine() throws java.io.IOException { 
        try {
            return reader.readLine();
        } catch (java.io.IOException e) {
            throw e;
        }
    }
    
    public void close() throws java.io.IOException { 
        try { 
            reader.close();
        } catch (java.io.IOException e) {
            throw e;
        }
    }
}
